//
//  RedPacketDetailTableViewCell.m
//  fxxiaoke
//
//  Created by 鞠超 on 2016/10/12.
//  Copyright © 2016年 jc. All rights reserved.
//

#import "RedPacketDetailTableViewCell.h"

@implementation RedPacketDetailTableViewCell

- (instancetype )initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if(self)
    {
        [self p_setupView];
    }
    
    return self;
}

- (void )p_setupView
{
    self.image = [[UIImageView alloc] init];
    self.image.layer.masksToBounds = YES;
    self.image.layer.cornerRadius = 20;
    self.image.image = [UIImage imageNamed:@"heads.jpg"];
    [self.contentView addSubview:self.image];
    
    self.name = [[UILabel alloc] init];
    self.name.text = @"员工姓名";
    self.name.font = [UIFont systemFontOfSize:17.0f];
    self.name.textColor = [UIColor blackColor];
    [self.contentView addSubview:self.name];
    
    self.time = [[UILabel alloc] init];
    self.time.text = @"11-23 22:11";
    self.time.textColor = [UIColor grayColor];
    self.time.font = [UIFont systemFontOfSize:15.0f];
    [self.contentView addSubview:self.time];
    
    self.money = [[UILabel alloc] init];
    self.money.text = @"0.88元";
    self.money.font = [UIFont systemFontOfSize:17.0f];
    self.money.textColor = [UIColor blackColor];
    self.money.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:self.money];
    
    self.best = [[UILabel alloc] init];
    self.best.text = @"手气最佳";
    self.best.hidden = YES;
    self.best.textColor = [UIColor grayColor];
    self.best.font = [UIFont systemFontOfSize:15.0f];
    self.best.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:self.best];
    
    self.view_Line = [[UIView alloc] init];
    self.view_Line.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:self.view_Line];
}

- (void )layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat length_x = (SCREEN_WIDTH - 70) / 2;
    
    self.image.frame = CGRectMake(10, 12.5, 40, 40);
    
    self.name.frame = CGRectMake(CGRectGetMaxX(self.image.frame) + 10, 12.5, length_x, 20);
    
    self.time.frame = CGRectMake(CGRectGetMaxX(self.image.frame) + 10, CGRectGetMaxY(self.name.frame) + 5, length_x, 15);
    
    self.money.frame = CGRectMake(CGRectGetMaxX(self.name.frame), 12.5, length_x, 20);
    
    self.best.frame = CGRectMake(CGRectGetMaxX(self.time.frame), CGRectGetMaxY(self.name.frame) + 5, length_x, 15);
    
    self.view_Line.frame = CGRectMake(CGRectGetMaxX(self.image.frame) + 10, 64, SCREEN_WIDTH - CGRectGetMaxX(self.image.frame) - 10, 1);
}
























@end
